﻿@using ECG.Common
@using ECG.Utility
@using ECG.WebUI.CustomHelpers
@model List<ProductMenuHomeDto>

<div class="cate-promo-l2">
    <div class="promo-header">
        <h1>@ViewBag.CateName</h1>
    </div>
    @{
        if (Model.Any())
        {
            var count = 0;
        <div class="promo-listtop4">
            <ul class="ul clearfix">
                @foreach (var item in Model)
                {
                    count++;
                    var pDetailLink = Url.Action("Index", "ProductDetail", new { productId = item.Id, productName = StringUtil.RemoveSpecialCharactersVn(item.Name) });
                    var css = "";
                    if (count == Model.Count)
                    {
                        css = "class='itemLastPromotion'";
                    }
                    <li @Html.Raw(css)>
                        <div class="promo-item clearfix">
                            <div class="promo-item-left fl">
                                <p>
                                    <h2>
                                        <a href="@pDetailLink">@item.Name</a>
                                    </h2>
                                </p>
                                @if (item.PromotionPrice > 0)
                                {
                                    <p class="pItem-PriceOld">
                                        @item.Price.ToString("##,###,###") <span>đ</span>
                                    </p>
                                    <p class="pItem-PriceNew">
                                        @item.PromotionPrice.ToString("##,###,###") <span>đ</span>
                                    </p>
                                }else
                                {
                                    <p class="pItem-PriceNew">
                                        @item.Price.ToString("##,###,###") <span>đ</span>
                                    </p>
                                }
                            </div>
                            <div class="promo-item-right fl">
                                @if (item.PromotionPrice > 0)
                                {
                                    <i class="iconpromo">-@item.DiscountPercentage%</i>
                                }
                                @*<i class="icongift"></i>*@
                                <a href="@pDetailLink">
                                    <img src="@item.ImagePath.ImagePathThumb(74, 74)" width="74" height="74" alt="@item.Name" class="fr" />
                                </a>
                            </div>
                        </div>
                    </li>
                }

            </ul>

        </div>
        }
    }
</div>
